package org.penguin.study.bk.controller

import org.penguin.study.bk.dao.MessageReactiveDao
import org.penguin.study.bk.entity.r2dbc.Message
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController
import reactor.core.publisher.Flux
import javax.annotation.Resource

@RestController
@RequestMapping("/flow")
class FlowMessageController {

    @Resource
    lateinit var messageReactiveDao: MessageReactiveDao

    @GetMapping("/messages")
    fun getAllMessages(): Flux<Message> {
        return messageReactiveDao.findAll()
    }
}